{% extends "RihabBundle::layout.html.twig" %}
{% block titre %}Tache{% endblock %}
{% block css %}
{{parent()}}
<link rel="stylesheet" href="/js/vendor/datepicker/css/bootstrap-datetimepicker.css">
<link rel="stylesheet" href="/js/vendor/chosen/css/chosen.min.css">
<link rel="stylesheet" href="/js/vendor/chosen/css/chosen-bootstrap.css">
{% endblock %}
{% block body %}
<div class="main">
    <div class="row">
        <div id="form-type" class="col-md-12">

            <section class="tile color transparent-black">
                <div class="tile-header">
                    <h1><strong>{% if id =='' %}Nouveau{% else %}Modifier{% endif %}</strong>Tache</h1>
                    <div class="controls">
                        <a class="refresh" href="#"><i class="fa fa-refresh"></i></a>
                        <a class="remove" href="#"><i class="fa fa-times"></i></a>
                    </div>
                </div>
                <div class="tile-body">
                    <form id="form-Tache" action="{{path('stage_tache_new')}}" method="post" class="form-horizontal">
                        <div class="form-group">
                            <label class="col-sm-4 control-label" for="input01">Date limite</label>
                            <div class="col-sm-8"> 
                                {{form_widget(form.dateLimite,{'attr':{'class':'form-control'}})}}
                                <input type="hidden" value="{{id}}" name="id" />
                            </div>
                            
                        </div>
                        <div class="form-group">
                            <label class="col-sm-4 control-label" for="input01">Description de la Tache</label>
                            <div class="col-sm-8">
                        {{form_widget(form.description,{'attr':{'class':'form-control'}})}}
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-4 control-label" for="input01">Etudiant</label>
                            <div class="col-sm-8">
                                <!-- eli yencadrihom hoa  form.getEtidiant().stageEncadreur_id! !-->
                        {{form_widget(form.users->getEtudiant(),{'attr':{'class':'form-control'}})}}
                            </div>
                        </div>

                        <div class="form-group form-footer">
                            <div class="col-sm-offset-4 col-sm-8">
                                <button class="btn btn-primary" type="submit" >Enregistrer</button>
                                <button class="btn btn-default" type="reset">Effacer</button>
                            </div>
                        </div>

                    </form>

                </div>
            </section>
        </div>
    </div>
</div>

{% endblock %}

{% block js %}
{{parent()}}
<script src="/js/vendor/momentjs/moment-with-langs.min.js"></script>
<script src="/js/vendor/datepicker/bootstrap-datetimepicker.min.js"></script>
<script src="/js/jquery.validate.js"></script>
<script>

                                    $('#form-Tache').validate({
                                        rules: 
                                            "stage_stagebundle_tache[description]": {
                                                required: true,
                                                minlength: 10,
                                                maxlength: 150

                                            


                                            }

                                        },   
                                        messages: {
                                        
                                            "stage_stagebundle_tache[description]": {
                                                required: "Le champ description est compris entre 10 et 150 caractère",
                                                minlength: "Le champ description est compris entre 10 et 150 caractère",
                                                maxlength: "Le champ description est compris entre 10 et 150 caractère"
                                            }
                                             
                                    })
                                   
                                   
                                    resetForm()
                                    
                                    
                                    function resetForm() {
                                        $('#form-tache input').val('')
                                    }
</script>
{% endblock %}